// ============================================================================
//
// LCP-net framework by Pierre CHATEL chatelp@gmail.com
// Distributed under GPLv3
// Copyright (C) THALES Land & Joint Systems, 2008, 2009. All rights reserved
//
// ============================================================================

/**
 * <copyright>
 * </copyright>
 *
 * $Id$
 */
package com.thalesgroup.preferenceFramework.models.LCPnet.impl;



import org.eclipse.emf.common.notify.Notification;
import org.eclipse.emf.ecore.EClass;
import org.eclipse.emf.ecore.InternalEObject;
import org.eclipse.emf.ecore.impl.ENotificationImpl;

import com.thalesgroup.preferenceFramework.models.LCPnet.LCPnetPackage;
import com.thalesgroup.preferenceFramework.models.LCPnet.LNodeValue;
import com.thalesgroup.preferenceFramework.models.LCPnet.LinguisticSubset;
import com.thalesgroup.preferenceFramework.models.impl.NodeValueImpl;

/**
 * <!-- begin-user-doc -->
 * An implementation of the model object '<em><b>LNode Value</b></em>'.
 * <!-- end-user-doc -->
 * <p>
 * The following features are implemented:
 * <ul>
 *   <li>{@link com.thalesgroup.preferenceFramework.models.LCPnet.impl.LNodeValueImpl#getLinguisticValue <em>Linguistic Value</em>}</li>
 * </ul>
 * </p>
 *
 * @generated
 */
public class LNodeValueImpl extends NodeValueImpl implements LNodeValue {
	/**
	 * The cached value of the '{@link #getLinguisticValue() <em>Linguistic Value</em>}' reference.
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @see #getLinguisticValue()
	 * @generated
	 * @ordered
	 */
	protected LinguisticSubset linguisticValue;
	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	protected LNodeValueImpl() {
		super();
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	@Override
	protected EClass eStaticClass() {
		return LCPnetPackage.Literals.LNODE_VALUE;
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public LinguisticSubset getLinguisticValue() {
		if (linguisticValue != null && linguisticValue.eIsProxy()) {
			InternalEObject oldLinguisticValue = (InternalEObject)linguisticValue;
			linguisticValue = (LinguisticSubset)eResolveProxy(oldLinguisticValue);
			if (linguisticValue != oldLinguisticValue) {
				if (eNotificationRequired())
					eNotify(new ENotificationImpl(this, Notification.RESOLVE, LCPnetPackage.LNODE_VALUE__LINGUISTIC_VALUE, oldLinguisticValue, linguisticValue));
			}
		}
		return linguisticValue;
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public LinguisticSubset basicGetLinguisticValue() {
		return linguisticValue;
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public void setLinguisticValue(LinguisticSubset newLinguisticValue) {
		LinguisticSubset oldLinguisticValue = linguisticValue;
		linguisticValue = newLinguisticValue;
		if (eNotificationRequired())
			eNotify(new ENotificationImpl(this, Notification.SET, LCPnetPackage.LNODE_VALUE__LINGUISTIC_VALUE, oldLinguisticValue, linguisticValue));
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	@Override
	public Object eGet(int featureID, boolean resolve, boolean coreType) {
		switch (featureID) {
			case LCPnetPackage.LNODE_VALUE__LINGUISTIC_VALUE:
				if (resolve) return getLinguisticValue();
				return basicGetLinguisticValue();
		}
		return super.eGet(featureID, resolve, coreType);
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	@Override
	public void eSet(int featureID, Object newValue) {
		switch (featureID) {
			case LCPnetPackage.LNODE_VALUE__LINGUISTIC_VALUE:
				setLinguisticValue((LinguisticSubset)newValue);
				return;
		}
		super.eSet(featureID, newValue);
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	@Override
	public void eUnset(int featureID) {
		switch (featureID) {
			case LCPnetPackage.LNODE_VALUE__LINGUISTIC_VALUE:
				setLinguisticValue((LinguisticSubset)null);
				return;
		}
		super.eUnset(featureID);
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	@Override
	public boolean eIsSet(int featureID) {
		switch (featureID) {
			case LCPnetPackage.LNODE_VALUE__LINGUISTIC_VALUE:
				return linguisticValue != null;
		}
		return super.eIsSet(featureID);
	}

} //LNodeValueImpl
